-
-
Notifications
You must be signed in to change notification settings - Fork 282
London -10- Akram-Izedi-Javascript-core-1-coursework-week3 #264
base: main
Are you sure you want to change the base?
Conversation
| } | ||
| return section; | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work
| } | ||
| return statements; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Afsoon
I sew you done nice work here with big effort and I want add here you can use .forEach method here kind of short cut with open big chances to know how function it work and make it more fun easy.
check here for more info
this is my review for this week
Thank Afsoon
|
|
||
| function getTemperatureReport(cities) { | ||
| // TODO | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me 👍 2 small notes:
- Sometimes it's more readable to use template literals in JavaScript. Read more about this here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
- Keep an eye on your code indentation (spacing). This can make your code easier to read for both yourself and other developers.
| The home page of the web site has a headline section, which only has space for article titles which are 65 characters or less. | ||
| Implement the function below, which will return a new array containing only article titles which will fit. | ||
| */ | ||
| function potentialHeadlines(allArticleTitles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
| */ | ||
| function titleWithFewestWords(allArticleTitles) { | ||
| // TODO | ||
| const separateTitleArray = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a think if you really need to create the separateTitleArray. Maybe you can use reduce on the allArticleTitles directly?
| allArticleTitles.toString().split(" "); | ||
| separateTitleArray.push(articleTitle) | ||
| } | ||
| let titleWithFewestWords = separateTitleArray.reduce((fewestWords, currentWords) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the code looks very good - but there's one small problem.
The question is asking you for the title with the fewest words - but here it looks like you're comparing the number of characters: currentWords.length < fewestWords.length
Can you think about how you might fix this?
| The Financial Times wants to understand what the average number of characters in an article title is. | ||
| Implement the function below to return this number - rounded to the nearest integer. | ||
| */ | ||
| function averageNumberOfCharacters(allArticleTitles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
| Solve the smaller problems, and then build those solutions back up to solve the larger problem. | ||
| Functions can help with this! | ||
| */ | ||
| function getAveragePrices(closingPricesForAllStocks) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good attempt! 😄 A few small points:
- The question is expecting us to use the array which is being passed in as a parameter:
closingPricesForAllStocksbut it looks like you're using theCLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKSarray instead - Spend some time thinking about the best way to name your variables. For example, in the code below you are using a
pricesvariable - but this is really just a single price, so maybepricewould be a better name here.
| (Apple's price on the 5th day) - (Apple's price on the 1st day) = 172.99 - 179.19 = -6.2 | ||
| The price change value should be rounded to 2 decimal places, and should be a number (not a string) | ||
| */ | ||
| function getPriceChanges(closingPricesForAllStocks) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks good. One point here:
In this code - stock[4] - stock[0] - what would happen if the arrays we were passing in had more than 5 prices? Or less than 5 prices? Could you change this so it works for any number of prices?
|
Good effort on this coursework @AkramIzedi 👏 |
No description provided.